flowbox: Be careful when the container is empty
authorDebarshi Ray <debarshir@gnome.org>
Mon, 21 Oct 2013 14:21:11 +0000 (16:21 +0200)
committerDebarshi Ray <debarshir@gnome.org>
Mon, 21 Oct 2013 14:21:11 +0000 (16:21 +0200)
Otherwise, showing an empty GtkFlowBox will lead to:
GLib-CRITICAL **: g_sequence_get: assertion '!is_end (iter)' failed

gtk/gtkflowbox.c

index e9c6367f40c1ea549fc15adcdfa6b59c090dd5ad..0bac89b3ae82086eac4e75a122a091a5baa6055e 100644 (file)
@@ -1215,6 +1215,9 @@ gtk_flow_box_get_first_focusable (GtkFlowBox *box)
   GtkFlowBoxChild *child;
 
   iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+  if (g_sequence_iter_is_end (iter))
+    return NULL;
+
   child = g_sequence_get (iter);
   if (child_is_visible (GTK_WIDGET (child)) &&
       gtk_widget_is_sensitive (GTK_WIDGET (child)))